package com.wxfbboy.suanfa.utils.algorithm;

import com.wxfbboy.suanfa.utils.algorithm.base.SortingAlgorithm;

public class SelectionSortingAlgorithm extends SortingAlgorithm {
    public static Comparable[] sort(Comparable[] a){
        int N = a.length;
        for( int i = 0 ; i < N ; i++ ){
            int min = i;
            for( int j = i + 1; j < N ; j++ ){
                if ( less( a[j] , a[min] ) ){
                    exch( a ,j ,min );
                }
            }
        }
        return a;
    }
}
